{% extends "director/index.html" %}
{% load static %}
{% load jsonify %}

{% block page_content %}

<script type="text/javascript">


	//	heads=
	//	row =
	//
	//
	//	can_add=
	//	can_log=
	//	can_del=

	$(function () {
		new Vue({
			el:'#there',
//			data:{
//				kw:{
//					heads:heads,
//			        row:row,
//			   		errors:{},
//				},
//				menu:menu,
//				can_add:can_add,
//				can_del:can_del,
//				can_log:can_log,
//			},
			mixins:[fieldset_fun],
			methods:{
				get_name:function(field_name){
					var ls = field_name.split('.')
					return ls[1]
				},
				get_kw:function(field_name){
					var ls = field_name.split('.')
					return this.fieldset[ls[0]]
				}
			}

		})
	})
</script>

<div id='there'>

	<div v-if="can_log" style='float: right;padding: 5px 20px;'>
		<a :href="log_url()">History</a>
	</div>
	<path-nav :menu='menu'>
		<li><span>编辑</span></li>
	</path-nav>

	<com-form-btn :submit="submit" :del_row="del_row" :cancel="cancel"></com-form-btn>
	<!--<div style='overflow: hidden;'>-->
	<!--<div class="btn-group" style='float: right;'>-->
	<!--<button type="button" class="btn btn-default" @click='submit()' v-if='can_add'>Save</button>-->
	<!--<button type="button" class="btn btn-default" v-if='can_del' @click='del_row()'>删除</button>-->
	<!--<button type="button" class="btn btn-default" @click='cancel()' >Cancel</button>-->
	<!--</div>-->
	<!--</div>-->

	<div v-if="namelist.length>0">

		<div v-for="name in namelist" >
			<h2 v-text="name.label"></h2>
			<div class='field-panel'>
				<field  v-for='field_name in name.fields' :key="field_name" :name='get_name(field_name)' :kw='get_kw(field_name)'></field>
			</div>

		</div>

	</div>
	<!--<div class='field-panel'>-->
		<!--<field  v-for='head in kw.heads' :key="head.name" :name='head.name' :kw='kw'></field>-->
	<!--</div>-->
</div>

{% endblock %}